#!/usr/bin/perl
package CookieC;
push (@INC , "D:/workplace/Apache2/mason/Model");
use strict;
use warnings;
use Apache::Cookie();

sub new{
    my $class = shift;

    my $r = Apache->request;

    my $cookie = Apache::Cookie->new($r,
        -name    =>  'id',
        -value   =>  '',
        -expires =>  '+1h',
        -domain  =>  '.capricorn.com',
        -path    =>  '/cgi-bin/database',
        -secure  =>  1
    );


    bless $cookie, $class;

    return $cookie;
};

sub get{
    my ($cookie) = @_;

    my $value = $cookie->value;

    return $value;
};

sub set{
    my ($cookie, $id) = @_;

    $cookie->value($id);

    return 1;
};

sub check{
    my ($cookie) = @_;

    my $value = $cookie->value;

    if(defined $value)
    {
        return 0;
    }else{
        return 1;
    }
};

1;



